

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>Options &mdash; KoSpeech 0.0 documentation</title>
  

  
  
  
  

  
  <script type="text/javascript" src="../_static/js/modernizr.min.js"></script>
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
        <script type="text/javascript" src="../_static/jquery.js"></script>
        <script type="text/javascript" src="../_static/underscore.js"></script>
        <script type="text/javascript" src="../_static/doctools.js"></script>
    
    <script type="text/javascript" src="../_static/js/theme.js"></script>

    

  
  <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="Seq2seq" href="../Seq2seq.html" />
    <link rel="prev" title="Preparation before Training" href="Preparation.html" /> 
</head>

<body class="wy-body-for-nav">

   
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >
          

          
            <a href="../index.html" class="icon icon-home"> KoSpeech
          

          
          </a>

          
            
            
              <div class="version">
                0.0
              </div>
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <p class="caption"><span class="caption-text">NOTES</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="intro.html">Intro</a></li>
<li class="toctree-l1"><a class="reference internal" href="Preparation.html">Preparation before Training</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Options</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#model-options">Model options</a></li>
<li class="toctree-l2"><a class="reference internal" href="#train-options">Train options</a></li>
<li class="toctree-l2"><a class="reference internal" href="#preprocess-options">Preprocess options</a></li>
<li class="toctree-l2"><a class="reference internal" href="#inference-options">Inference options</a></li>
</ul>
</li>
</ul>
<p class="caption"><span class="caption-text">ARCHITECTURE</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../Seq2seq.html">Seq2seq</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Transformer.html">Transformer</a></li>
</ul>
<p class="caption"><span class="caption-text">PACKAGE REFERENCE</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../Checkpoint.html">Checkpoint</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Data.html">Data</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Decode.html">Decode</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Evaluator.html">Evaluator</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Optim.html">Optim</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Trainer.html">Trainer</a></li>
<li class="toctree-l1"><a class="reference internal" href="../Etc.html">Etc</a></li>
</ul>

            
          
        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../index.html">KoSpeech</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../index.html">Docs</a> &raquo;</li>
        
      <li>Options</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
            
            <a href="../_sources/notes/opts.md.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="options">
<h1>Options<a class="headerlink" href="#options" title="Permalink to this headline">¶</a></h1>
<p>main.py</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">usage</span><span class="p">:</span> <span class="n">main</span><span class="o">.</span><span class="n">py</span> <span class="p">[</span><span class="o">-</span><span class="n">h</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">mode</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">sample_rate</span><span class="p">]</span>
               <span class="p">[</span><span class="o">--</span><span class="n">window_size</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">stride</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">n_mels</span><span class="p">]</span>
               <span class="p">[</span><span class="o">--</span><span class="n">normalize</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">del_silence</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">input_reverse</span><span class="p">]</span>
               <span class="p">[</span><span class="o">--</span><span class="n">feature_extract_by</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">time_mask_para</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">freq_mask_para</span><span class="p">]</span>
               <span class="p">[</span><span class="o">--</span><span class="n">time_mask_num</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">freq_mask_num</span><span class="p">]</span>
               <span class="p">[</span><span class="o">--</span><span class="n">use_bidirectional</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">hidden_dim</span><span class="p">]</span>
               <span class="p">[</span><span class="o">--</span><span class="n">dropout</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">num_heads</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">label_smoothing</span><span class="p">]</span>
               <span class="p">[</span><span class="o">--</span><span class="n">listener_layer_size</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">speller_layer_size</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">rnn_type</span><span class="p">]</span>
               <span class="p">[</span><span class="o">--</span><span class="n">extractor</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">activation</span><span class="p">]</span>
               <span class="p">[</span><span class="o">--</span><span class="n">attn_mechanism</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">teacher_forcing_ratio</span><span class="p">]</span>
               <span class="p">[</span><span class="o">--</span><span class="n">dataset_path</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">data_list_path</span><span class="p">]</span>
               <span class="p">[</span><span class="o">--</span><span class="n">label_path</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">init_uniform</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">spec_augment</span><span class="p">]</span>
               <span class="p">[</span><span class="o">--</span><span class="n">noise_augment</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">noiseset_size</span><span class="p">]</span>
               <span class="p">[</span><span class="o">--</span><span class="n">noise_level</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">use_cuda</span><span class="p">]</span>
               <span class="p">[</span><span class="o">--</span><span class="n">batch_size</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">num_workers</span><span class="p">]</span>
               <span class="p">[</span><span class="o">--</span><span class="n">num_epochs</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">init_lr</span><span class="p">]</span>
               <span class="p">[</span><span class="o">--</span><span class="n">high_plateau_lr</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">low_plateau_lr</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">valid_ratio</span><span class="p">]</span>
               <span class="p">[</span><span class="o">--</span><span class="n">max_len</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">max_grad_norm</span><span class="p">]</span>
               <span class="p">[</span><span class="o">--</span><span class="n">rampup_period</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">decay_threshold</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">exp_decay_period</span><span class="p">]</span>
               <span class="p">[</span><span class="o">--</span><span class="n">teacher_forcing_step</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">min_teacher_forcing_ratio</span><span class="p">]</span>
               <span class="p">[</span><span class="o">--</span><span class="n">seed</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">save_result_every</span><span class="p">]</span>
               <span class="p">[</span><span class="o">--</span><span class="n">checkpoint_every</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">print_every</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">resume</span><span class="p">]</span>
</pre></div>
</div>
<div class="section" id="model-options">
<h2>Model options<a class="headerlink" href="#model-options" title="Permalink to this headline">¶</a></h2>
<ul class="simple">
<li><code class="docutils literal notranslate"><span class="pre">--use_bidirectional</span></code> : if True, becomes a bidirectional encoder (defulat: <code class="docutils literal notranslate"><span class="pre">False</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--hidden_dim</span></code> : hidden state dimension of model (default: <code class="docutils literal notranslate"><span class="pre">256</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--dropout</span></code> : dropout ratio in training (default: <code class="docutils literal notranslate"><span class="pre">0.3</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--num_heads</span></code> : number of head in attention (default: <code class="docutils literal notranslate"><span class="pre">8</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--label_smoothing</span></code> : ratio of label smoothing (default: <code class="docutils literal notranslate"><span class="pre">0.1</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--listener_layer_size</span></code> : layer size of encoder (default: <code class="docutils literal notranslate"><span class="pre">5</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--speller_layer_size</span></code> : layer size of decoder (default: <code class="docutils literal notranslate"><span class="pre">3</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--rnn_type</span></code> : type of rnn cell: [gru, lstm, rnn] (default: <code class="docutils literal notranslate"><span class="pre">gru</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--attn_mechanism</span></code> : option to specify the attention mechanism method (default: <code class="docutils literal notranslate"><span class="pre">loc</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--teacher_forcing_ratio</span></code> : teacher forcing ratio in decoding (default: <code class="docutils literal notranslate"><span class="pre">0.99</span></code>)</li>
</ul>
</div>
<div class="section" id="train-options">
<h2>Train options<a class="headerlink" href="#train-options" title="Permalink to this headline">¶</a></h2>
<ul class="simple">
<li><code class="docutils literal notranslate"><span class="pre">--dataset_path</span></code> : path of dataset</li>
<li><code class="docutils literal notranslate"><span class="pre">--data_list_path</span></code> : list of training / test set</li>
<li><code class="docutils literal notranslate"><span class="pre">--label_path</span></code> : path of character labels</li>
<li><code class="docutils literal notranslate"><span class="pre">--use_multi_gpu</span></code> : flag indication whether to use multi-gpu in training</li>
<li><code class="docutils literal notranslate"><span class="pre">--init_uniform</span></code> : flag indication whether to initiate model`s parameters as uniformly</li>
<li><code class="docutils literal notranslate"><span class="pre">--spec_augment</span></code> : flag indication whether to use spec augmentation or not</li>
<li><code class="docutils literal notranslate"><span class="pre">--noise_augment</span></code> : flag indication whether to use noise augmentation or not</li>
<li><code class="docutils literal notranslate"><span class="pre">--noiseset_size</span></code> : size of noise dataset for noise augmentation (default: <code class="docutils literal notranslate"><span class="pre">1000</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--noise_level</span></code> : set level of noise (default: <code class="docutils literal notranslate"><span class="pre">0.7</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--use_cuda</span></code> : flag indication whether to use cuda or not</li>
<li><code class="docutils literal notranslate"><span class="pre">--batch_size</span></code> : batch size in training (default: <code class="docutils literal notranslate"><span class="pre">32</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--num_workers</span></code> : number of workers in dataset loader (default: <code class="docutils literal notranslate"><span class="pre">4</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--num_epochs</span></code> : number of epochs in training (default: <code class="docutils literal notranslate"><span class="pre">20</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--init_lr</span></code> : initial learning rate =&gt; before ramp up lr (default: <code class="docutils literal notranslate"><span class="pre">1e-15</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--high_plateau_lr</span></code> : high plateau learning rate =&gt; after rampup lr (default: <code class="docutils literal notranslate"><span class="pre">3e-04</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--low_plateau_lr</span></code> : low plateau learning rate =&gt; after exponential decay (default: <code class="docutils literal notranslate"><span class="pre">1e-05</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--valid_ratio</span></code> : validation dataset ratio in training dataset (default: <code class="docutils literal notranslate"><span class="pre">0.01</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--max_len</span></code> : maximum characters of sentence (default: <code class="docutils literal notranslate"><span class="pre">151</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--max_grad_norm</span></code> : value used for gradient norm clipping (default: <code class="docutils literal notranslate"><span class="pre">400</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--rampup_period</span></code> : timestep of learning rate rampup (default: <code class="docutils literal notranslate"><span class="pre">1000</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--decay_threshold</span></code> : If the improvement of cer less than this, exponential decay lr start. (default: <code class="docutils literal notranslate"><span class="pre">0.02</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--exp_decay_period</span></code> : Timestep of learning rate decay (default: <code class="docutils literal notranslate"><span class="pre">160000</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--teacher_forcing_step</span></code> : The value at which teacher forcing ratio will be reducing</li>
<li><code class="docutils literal notranslate"><span class="pre">--min_teacher_forcing_ratio</span></code> : The minimum value of teacher forcing ratio</li>
<li><code class="docutils literal notranslate"><span class="pre">--seed</span></code> : random seed (default: <code class="docutils literal notranslate"><span class="pre">7</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--save_result_every</span></code> : to determine whether to store training results every N timesteps (default: <code class="docutils literal notranslate"><span class="pre">1000</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--checkpoint_every</span></code> : to determine whether to store training checkpoint every N timesteps (default: <code class="docutils literal notranslate"><span class="pre">5000</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--print_every</span></code> : to determine whether to store training progress every N timesteps (default: <code class="docutils literal notranslate"><span class="pre">10</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--resume</span></code> : Indicates if training has to be resumed from the latest checkpoint (default: <code class="docutils literal notranslate"><span class="pre">False</span></code>)</li>
</ul>
</div>
<div class="section" id="preprocess-options">
<h2>Preprocess options<a class="headerlink" href="#preprocess-options" title="Permalink to this headline">¶</a></h2>
<ul class="simple">
<li><code class="docutils literal notranslate"><span class="pre">--sample_rate</span></code> : sample rate (default: <code class="docutils literal notranslate"><span class="pre">16000</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--window_size</span></code> : Window size for spectrogram (default: <code class="docutils literal notranslate"><span class="pre">20</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--stride</span></code> : Window stride for spectrogram (default: <code class="docutils literal notranslate"><span class="pre">10</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--n_mels</span></code> : number of mel filter (default: <code class="docutils literal notranslate"><span class="pre">80</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--normalize</span></code> : flag indication whether to normalize spectrogram or not (default: <code class="docutils literal notranslate"><span class="pre">False</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--del_silence</span></code> : flag indication whether to delete silence or not (default: <code class="docutils literal notranslate"><span class="pre">False</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--input_reverse</span></code> : flag indication whether to reverse input or not (default: <code class="docutils literal notranslate"><span class="pre">False</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--feature_extract_by</span></code> : which library to use for feature extraction: [librosa, torchaudio] (default: <code class="docutils literal notranslate"><span class="pre">librosa</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--time_mask_para</span></code> : Hyper Parameter for Time Masking to limit time masking length (default: <code class="docutils literal notranslate"><span class="pre">50</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--freq_mask_para</span></code> : Hyper Parameter for Freq Masking to limit freq masking length (default: <code class="docutils literal notranslate"><span class="pre">12</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--time_mask_num</span></code> : how many time-masked area to make (default: <code class="docutils literal notranslate"><span class="pre">2</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--freq_mask_num</span></code> : how many freq-masked area to make (default: <code class="docutils literal notranslate"><span class="pre">2</span></code>)</li>
</ul>
</div>
<div class="section" id="inference-options">
<h2>Inference options<a class="headerlink" href="#inference-options" title="Permalink to this headline">¶</a></h2>
<ul class="simple">
<li><code class="docutils literal notranslate"><span class="pre">--dataset_path</span></code> : path of dataset</li>
<li><code class="docutils literal notranslate"><span class="pre">--data_list_path</span></code> : list of training / test set</li>
<li><code class="docutils literal notranslate"><span class="pre">--label_path</span></code> : path of character labels</li>
<li><code class="docutils literal notranslate"><span class="pre">--use_multi_gpu</span></code> : flag indication whether to use multi-gpu in training</li>
<li><code class="docutils literal notranslate"><span class="pre">--num_workers</span></code> : number of workers in dataset loader (default: <code class="docutils literal notranslate"><span class="pre">4</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--use_cuda</span></code> : flag indication whether to use cuda or not</li>
<li><code class="docutils literal notranslate"><span class="pre">--model_path</span></code> : path to load models (default: <code class="docutils literal notranslate"><span class="pre">None</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--batch_size</span></code> : batch size in inference (default: <code class="docutils literal notranslate"><span class="pre">1</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--k</span></code> : size of beam (default: <code class="docutils literal notranslate"><span class="pre">5</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--use_beam_search</span></code> : flag indication whether to use beam search decoding or not (default: <code class="docutils literal notranslate"><span class="pre">False</span></code>)</li>
<li><code class="docutils literal notranslate"><span class="pre">--print_every</span></code> : to determine whether to store inference progress every N timesteps (default: <code class="docutils literal notranslate"><span class="pre">10</span></code>)</li>
</ul>
</div>
</div>


           </div>
           
          </div>
          <footer>
  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
        <a href="../Seq2seq.html" class="btn btn-neutral float-right" title="Seq2seq" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
      
      
        <a href="Preparation.html" class="btn btn-neutral float-left" title="Preparation before Training" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
      
    </div>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; Copyright 2020, Soohwan Kim

    </p>
  </div>
  Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. 

</footer>

        </div>
      </div>

    </section>

  </div>
  


  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>